package com.lz.base.project.thread.runnable;

import com.lz.base.common.utils.http.OkHttpUtil;
import com.lz.base.common.utils.http.SstInf;

import java.util.concurrent.CountDownLatch;

public class ThreadRunableLatch implements Runnable {
    private String city;
    private CountDownLatch countDownLatch;

    public ThreadRunableLatch(String city, CountDownLatch countDownLatch) {
        this.city = city;
        this.countDownLatch = countDownLatch;
    }

    public void run() {
        try {
            SstInf sstInf = new SstInf();
            sstInf.setInfFullUrl("https://query.asilu.com/weather/baidu");
            sstInf.setInfRequest("{city: " + city + "}");
            String s = OkHttpUtil.requestGet(sstInf);
            System.out.println("city:" + s);
        } catch (Exception e) {
        } finally {
            countDownLatch.countDown();
        }

    }
}